package com.bbh.plugin.single.privilege.core.service;


import com.bbh.plugin.single.privilege.core.repository.AppMapper;
import com.bbh.plugin.single.privilege.core.entity.App;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

import com.bbh.common.base.service.BaseService;
/**
 * Created by roman_000 on 2015/7/15.
 */
@Service
@Transactional
public class AppService extends BaseService<App, String> {
    @Autowired
    private AppMapper appMapper;
    @Transactional(readOnly = true)
    public App findByAppNameCode(String appKey) {
        App app = new App();
        app.setAppKey(appKey);
        List<App> appList = this.select(app);
        if (CollectionUtils.isNotEmpty(appList)) {
            return appList.get(0);
        }
        return new App();
    }


}
